function superadmin{

	function Get-ScriptPath
	{
		if($myInvocation.ScriptName) { $myInvocation.ScriptName }
		else { $myInvocation.MyCommand.Definition }
	}
	
	$halfpath = Get-ScriptPath 
	Import-Module $halfpath.replace("Hauptformular.psm1","Benutzerverwaltung.psm1")
	Import-Module $halfpath.replace("Hauptformular.psm1","Projektverwaltung.psm1")
	Import-Module $halfpath.replace("Hauptformular.psm1","CSVImport.psm1")
	Import-Module $halfpath.replace("Benutzerverwaltung.psm1","EinzelneBenutzerVerwalten.psm1")
	
	
	############### Hilfsfiles initialisieren ##############################
	
	$programdata = dir env:programdata
	$programdatapath = $programdata.value + "\superadmin2010_Data\"
	$logdata = $programdatapath + "Logfile.txt"
	$tempdata = $programdatapath + "temp.txt"
	$Einstellungsdata = $programdatapath + "Einstellungen.xml"
	
	if((Test-Path -path $programdatapath) -eq $true)
	{
		if((Test-Path -path $logdata) -ne $true)
		{
			New-Item -ItemType file ($programdatapath + "Logfile.txt")
		}
		if((Test-Path -path $tempdata) -ne $true)
		{
			New-Item -ItemType file ($programdatapath + "temp.txt")
		}
		if((Test-Path -path $Einstellungsdata) -ne $true)
		{
			$xml_orgin = $halfpath.replace("Hauptformular.psm1","Einstellungen.xml")
			Copy-Item $xml_orgin $programdatapath
		}
	}
	else
	{
		New-Item $programdatapath -type directory
		
		# Kopiert .xml file
		$xml_orgin = $halfpath.replace("Hauptformular.psm1","Einstellungen.xml")
		Copy-Item $xml_orgin $programdatapath
		New-Item -ItemType file ($programdatapath + "temp.txt")
		New-Item -ItemType file ($programdatapath + "Logfile.txt")
		
	}

	#Generated Form Function
	function GenerateForm {
	
		#region Import the Assemblies
		[reflection.assembly]::loadwithpartialname("System.Windows.Forms") | Out-Null
		[reflection.assembly]::loadwithpartialname("System.Drawing") | Out-Null
		#endregion
		
		#region Generated Form Objects
		$form1 = New-Object System.Windows.Forms.Form
		$lbl_Titel = New-Object System.Windows.Forms.Label
		$cmd_Projektverwaltung = New-Object System.Windows.Forms.Button
		$cmd_Benutzerverwaltung = New-Object System.Windows.Forms.Button
		$pictureBox1 = New-Object System.Windows.Forms.PictureBox
		$InitialFormWindowState = New-Object System.Windows.Forms.FormWindowState
		#endregion Generated Form Objects
		
		#----------------------------------------------
		#Generated Event Script Blocks
		#----------------------------------------------
		#Provide Custom Code for events specified in PrimalForms.
		$handler_form1_Load= 
		{
			#TODO: Place custom script here
		}
		
		$handler_cmd_Benutzerverwaltung_Click= 
		{
			Benutzerverwaltung
		}
		
		$handler_cmd_Projektverwaltung_Click= 
		{
			Projektverwaltung
		}
		
		$OnLoadForm_StateCorrection=
		{	#Correct the initial state of the form to prevent the .Net maximized form issue
			$form1.WindowState = $InitialFormWindowState
		}
		
		#----------------------------------------------
		#region Generated Form Code
		$form1.Text = "Superadmin2010"
		$form1.Name = "form1"
		$form1.DataBindings.DefaultDataSourceUpdateMode = 0
		$System_Drawing_Size = New-Object System.Drawing.Size
		$System_Drawing_Size.Width = 383
		$System_Drawing_Size.Height = 317
		$form1.ClientSize = $System_Drawing_Size
		$form1.add_Load($handler_form1_Load)
		$form1.FormBorderStyle = 5
		$form1.startposition = 1
		
		$cmd_Projektverwaltung.TabIndex = 1
		$cmd_Projektverwaltung.Name = "cmd_Projektverwaltung"
		$System_Drawing_Size = New-Object System.Drawing.Size
		$System_Drawing_Size.Width = 180
		$System_Drawing_Size.Height = 32
		$cmd_Projektverwaltung.Size = $System_Drawing_Size
		$cmd_Projektverwaltung.UseVisualStyleBackColor = $True
		
		$cmd_Projektverwaltung.Text = "Projektverwaltung"
		$cmd_Projektverwaltung.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",9.75,1,3,0)
		
		$System_Drawing_Point = New-Object System.Drawing.Point
		$System_Drawing_Point.X = 100
		$System_Drawing_Point.Y = 200
		$cmd_Projektverwaltung.Location = $System_Drawing_Point
		$cmd_Projektverwaltung.DataBindings.DefaultDataSourceUpdateMode = 0
		$cmd_Projektverwaltung.add_Click($handler_cmd_Projektverwaltung_Click)
		
		$form1.Controls.Add($cmd_Projektverwaltung)
		
		$cmd_Benutzerverwaltung.TabIndex = 0
		$cmd_Benutzerverwaltung.Name = "cmd_Benutzerverwaltung"
		$System_Drawing_Size = New-Object System.Drawing.Size
		$System_Drawing_Size.Width = 180
		$System_Drawing_Size.Height = 32
		$cmd_Benutzerverwaltung.Size = $System_Drawing_Size
		$cmd_Benutzerverwaltung.UseVisualStyleBackColor = $True
		
		$cmd_Benutzerverwaltung.Text = "Benutzerverwaltung"
		$cmd_Benutzerverwaltung.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",9.75,1,3,0)
		
		$System_Drawing_Point = New-Object System.Drawing.Point
		$System_Drawing_Point.X = 100
		$System_Drawing_Point.Y = 160
		$cmd_Benutzerverwaltung.Location = $System_Drawing_Point
		$cmd_Benutzerverwaltung.DataBindings.DefaultDataSourceUpdateMode = 0
		$cmd_Benutzerverwaltung.add_Click($handler_cmd_Benutzerverwaltung_Click)
		
		$form1.Controls.Add($cmd_Benutzerverwaltung)
		
		$lbl_Titel.TabIndex = 0
		$lbl_Titel.Backcolor = [System.Drawing.Color]::FromArgb(0,255,255,255)
		$System_Drawing_Size = New-Object System.Drawing.Size
		$System_Drawing_Size.Width = 207
		$System_Drawing_Size.Height = 40
		$lbl_Titel.Size = $System_Drawing_Size
		$lbl_Titel.Text = "Superadmin"
		$lbl_Titel.Font = New-Object System.Drawing.Font("Microsoft Sans Serif",26.25,0,3,0)

		$System_Drawing_Point = New-Object System.Drawing.Point
		$System_Drawing_Point.X = 90
		$System_Drawing_Point.Y = 100
		$lbl_Titel.Location = $System_Drawing_Point
		$lbl_Titel.DataBindings.DefaultDataSourceUpdateMode = 0
		$lbl_Titel.Name = "lbl_Titel"

		$form1.Controls.Add($lbl_Titel)


		
		$pictureBox1.TabIndex = 3
		$System_Drawing_Size = New-Object System.Drawing.Size
		$System_Drawing_Size.Width = 388
		$System_Drawing_Size.Height = 320
		$pictureBox1.Size = $System_Drawing_Size
		
		$pictureBox1.Image = [System.Drawing.Image]::FromFile($halfpath.replace("Hauptformular.psm1","Hintergrund.jpg"))
		$System_Drawing_Point = New-Object System.Drawing.Point
		$System_Drawing_Point.X = -1
		$System_Drawing_Point.Y = -1
		$pictureBox1.Location = $System_Drawing_Point
		
		
		$pictureBox1.TabStop = $False
		$pictureBox1.Name = "pictureBox1"
		$pictureBox1.DataBindings.DefaultDataSourceUpdateMode = 0
		
		$form1.Controls.Add($pictureBox1)
		
		
		
		#endregion Generated Form Code
		
		#Save the initial state of the form
		$InitialFormWindowState = $form1.WindowState
		#Init the OnLoad event to correct the initial state of the form
		$form1.add_Load($OnLoadForm_StateCorrection)
		#Show the Form
		$form1.ShowDialog()| Out-Null
		
	} #End Function Generate Form
	
	#Call the Function
	GenerateForm
	
	Export-ModuleMember superadmin
	
}#End Function superadmin

